package com.wdg.template.entity;

import com.wdg.common.basemodule.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 用户实体
 */
@Getter
@Setter
@Table(name = "users")
@Entity
public class TemplateEntity extends BaseEntity {

    @Column(name = "phone_number")
    private String phoneNumber;

    @Column(name = "nick_name")
    private String nickName;

    @Column(name = "register_date")
    private Long registerDate;

    private Long lastLoginTime;

    @Column(name = "gender")
    private Integer gender;

    @Column(name = "status")
    private Integer status;

    @Column(name = "avatar")
    private String avatar;

    @Column(name = "role")
    private Integer role;

    @Column(name = "score")
    private Integer score;

    @Column(name = "token")
    private String token;

    public static TemplateEntity create(Long id){
        TemplateEntity templateEntity = new TemplateEntity();
        templateEntity.setId(id);
        templateEntity.setCreatorId(id);
        templateEntity.setDeleted(Boolean.FALSE);
        templateEntity.setCreateTime(System.currentTimeMillis());
        templateEntity.setRegisterDate(System.currentTimeMillis());
        return templateEntity;
    }
}
